/** CODE EVALL::Easy [Rightmost Char]
 *	Given string 'S' and character 't'. Print out position of rightmost
 *	occurence of 't' (case matters) in 'S' or -1 if there is none.
 *	Position to be printed is zero based.
 *
 *	Solution by Michael Pio Arroyo
 */

#include <iostream>
#include <fstream>
#include <string>
#include <iterator>

int main(int argc, char** argv) {
	std::ifstream file;
	std::string line;
	file.open(argv[1]);
	while(getline(file, line)) {
		int index = -1;
		for(std::string::iterator it = line.begin(); it!=line.end()-1; ++it) {
			if(*it == line.at(line.length()-1))
				index = std::distance(line.begin(), it);
		}
		std::cout << index;
		putchar('\n');
	}

	file.close();
	return 0;
}